package com.kunbo.cn.service.impl.uflo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import com.kunbo.cn.dao.uflo.DynamicTaskDao;
import com.kunbo.cn.entity.uflo.entity.DynamicTask;
import com.kunbo.cn.service.uflo.DynamicTaskService;

/**
 * <p>
 * 定时任务表 服务实现类
 * </p>
 *
 * @author liuyu
 * @since 2018-01-22
 */
@Service
public class DynamicTaskServiceImpl implements DynamicTaskService {
	
	@Autowired
	private DynamicTaskDao dao;

	@Override
	public Page<DynamicTask> findAll(int pageNumber,int pageSize) {
		Sort sort = new Sort(Sort.Direction.DESC,"createTime"); 
		Pageable pageable = new PageRequest(pageNumber,pageSize,sort);
		Page<DynamicTask> page = dao.findAll(pageable);
		return page;
	}

	@Override
	public void saveAndFlush(DynamicTask task) {
		dao.saveAndFlush(task);
	}

	@Override
	public DynamicTask findById(String id) {
		return dao.findOne(id);
	}


}
